package org.aeon.client.view.components.sessionPanel;

import org.aeon.entity.dto.GroupInfoDto;
import org.aeon.utils.SwingUtil;

import javax.swing.*;
import java.awt.*;

/**
 * @author: MissingAeon
 * @date: 2024/2/21 8:54
 * @description:
 */
public class GroupAnnouncementPanel extends JPanel {

    private final JLabel content;

    public GroupAnnouncementPanel(Dimension preferredSize) {
        SwingUtil.setSize(this, preferredSize);

        final Box box = Box.createVerticalBox();
        // 设置 Box 左对齐
        box.setAlignmentX(Component.LEFT_ALIGNMENT);

        final JLabel title = new JLabel("群描述");
        title.setFont(new Font("黑体", Font.BOLD, 22));
        // 设置标题标签左对齐
        title.setAlignmentX(Component.LEFT_ALIGNMENT);
        box.add(title);

        box.add(Box.createVerticalStrut(10));

        content = new JLabel("这是群公告....");
        content.setFont(new Font("黑体", Font.PLAIN, 14));
        content.setAlignmentX(Component.LEFT_ALIGNMENT);
        box.add(content);

        this.add(box);

    }

    public void load(GroupInfoDto group) {
        content.setText(group.getGroupDescription());
    }
}
